package com.zhongketech.sunflower.view;

import com.zhongketech.sunflower.database.ApplicationData;
import com.zhongketech.sunflower.database.Data;
import com.zhongketech.sunflower.util.Constants;
import com.zhongketech.sunflower.util.Utilities;

import android.content.Context;
import android.widget.ArrayAdapter;


public class UninstallList {


	private static UninstallList instance = null;

	private Context context = null;
	private ArrayAdapter<String> arrayAdapter = null;

	private int MAX_LOG_COUNT = 100;
	//private List<String> logString = new ArrayList<String>();


	private UninstallList()
	{

	}

	public static UninstallList getInstance(Context c)
	{   
		if(null == instance || c != instance.context)
		{
			instance = new UninstallList();
			instance.context = c;
			instance.init();

		}

		return instance;   
	}

	private void init()
	{
		arrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1);
		update();
	}

	public ArrayAdapter<String> getAdapter()
	{
		return arrayAdapter;
	}

	public void update()
	{
//		arrayAdapter.clear();
//
//		Utilities.logCat("UninstallList", "UninstallList update:"+Data.getinstance().getApplicationDataCount(), Constants.LOG_INFO);
//		
//		
//		for(int i = 0;i < Data.getinstance().getApplicationDataCount();i ++)
//		{
//			Utilities.logCat("UninstallList", "UninstallList update", Constants.LOG_INFO);
//			String show = "";
//			if(null != Data.getinstance().getApplicationDataByIndex(i).getAppName())
//			{
//				show = Data.getinstance().getApplicationDataByIndex(i).getAppName();
//			}
//			
//			if(null != Data.getinstance().getApplicationDataByIndex(i).getPackageName())
//			{
//				if("".equals(show))
//				{
//					show = Data.getinstance().getApplicationDataByIndex(i).getPackageName();
//				}
//				else
//				{
//					show = show + ":" +Data.getinstance().getApplicationDataByIndex(i).getPackageName();
//				}
//				
//			}
//			
//			arrayAdapter.add(show);
//		}
	}
}
